local shikongchuansuo = fk.CreateSkill{
    name = "ym2__shikongchuansuo",
}
Fk:loadTranslationTable{
    ["ym2__shikongchuansuo"] = "时空穿梭",
    [":ym2__shikongchuansuo"] = "若场上无濒死角色，“其他角色使用牌指定你为目标时”为你使用即时牌的合法时机，且此时你可以使用牌堆顶的X张牌。（X为3-你本回合已发动此技能的次数）",

    ["$ym2__shikongchuansuo1"] = "推演开始。",
    ["$ym2__shikongchuansuo2"] = "是时候结束了。",
    ["$ym2__shikongchuansuo3"] = "踏入我的棋局。",
    ["$ym2__shikongchuansuo4"] = "你命数已尽！",
}
shikongchuansuo:addEffect(fk.TargetConfirming,{
    can_trigger = function(self, event, target, player, data)
        return target == player and data.from and data.from ~= player and player:hasSkill(shikongchuansuo.name) and table.every(player.room.alive_players, function (p) return not p.dying end)
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local ids = {}
        local num = math.max(0,3 - player:usedSkillTimes(shikongchuansuo.name,Player.HistoryTurn))
        if num > 0 then
            if #room.draw_pile < num then room:shuffleDrawPile() end
            for _, cid in ipairs(room.draw_pile) do
                if #ids < num then
                    table.insertIfNeed(ids,cid)
                else
                    break
                end
            end
        end
        room:setPlayerMark(player,shikongchuansuo.name,ids)
        local use = room:askToPlayCard(player,{
            skill_name = shikongchuansuo.name,
            skip = true,
        })
        room:setPlayerMark(player,shikongchuansuo.name,0)
        if use then
            event:setCostData(self,use)
            return use
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local use = event:getCostData(self)
        room:useCard(use)
    end,
})
shikongchuansuo:addEffect("filter",{
    handly_cards = function (self, player)
        return player:getTableMark(shikongchuansuo.name)
    end,
})
return shikongchuansuo